<template>
  <div>
    <!-- input -->
    <base-text-field
      v-if="configItem.type === 'text'"
      v-model="formValue"
      :config-item="configItem"
      :hide-detail="hideDetail"
      :hide-rules="hideRules"
      @input="$emit('input', formValue)"
    >
    </base-text-field>

    <!-- input password -->
    <base-password-text
      v-if="configItem.type === 'password'"
      v-model="formValue"
      :config-item="configItem"
      :hide-detail="hideDetail"
      :hide-rules="hideRules"
      @input="$emit('input', formValue)"
    >
    </base-password-text>

    <!-- input number -->
    <base-number
      v-if="configItem.type === 'number'"
      v-model="formValue"
      :config-item="configItem"
      :hide-detail="hideDetail"
      :hide-rules="hideRules"
      @input="$emit('input', formValue)"
    >
    </base-number>
  </div>
</template>

<script>
import BaseNumber from '../BaseSingleComponent/BaseNumber.vue'
import BasePasswordText from '../BaseSingleComponent/BasePasswordText.vue'
import BaseTextField from '../BaseSingleComponent/BaseTextField.vue'

export default {
  // 表单主体内容
  name: 'FormContent',

  components: { BaseTextField, BaseNumber, BasePasswordText },

  props: {
    // 表单值
    value: { type: [String, Number, Boolean, Array], default: null },
    // 配置信息,
    configItem: { type: Object, default: () => {} },
    // 隐藏信息
    hideDetail: { type: Boolean, default: false },
    // 不校验规则
    hideRules: { type: Boolean, default: false },
    // 表单类型
    formFlag: { type: String, default: 'form' }
  },

  data() {
    return {
      formValue: this.value
    }
  },

  methods: {}
}
</script>

<style></style>
